package thing1;

import org.apache.rocketmq.client.producer.LocalTransactionState;
import org.apache.rocketmq.client.producer.TransactionListener;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageExt;

public class MyTranListener implements TransactionListener {
    //执行本地事务
    @Override
    public LocalTransactionState executeLocalTransaction(Message message, Object o) {
        System.out.println("提交成功");
        return LocalTransactionState.COMMIT_MESSAGE;
    }
    //回查事务状态，保持一致性
    @Override
    public LocalTransactionState checkLocalTransaction(MessageExt messageExt) {
        //根据返回的状态,确定返回值
        return LocalTransactionState.ROLLBACK_MESSAGE;
    }
}